package com.caiju.health.controller;


import com.caiju.health.constant.MessageConstant;
import com.caiju.health.entity.PageResult;
import com.caiju.health.entity.Result;
import com.caiju.health.service.ITcmConstitutionIdentificationService;
import com.caiju.health.vo.QueryPageBean;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RequestMapping("/tcmConstitutionIdentification")
@RestController
@CrossOrigin
public class TcmConstitutionIdentificationController {

    @Resource
    private ITcmConstitutionIdentificationService tcmConstitutionIdentificationService;
    @GetMapping("/findTcmConstitutionIdentificationByCondition")
    public PageResult findTcmConstitutionIdentificationByCondition(QueryPageBean queryPageBean){
        //从queryPageBean获取查询的条件
        //currentPage  页码
        Integer currentPage = queryPageBean.getCurrentPage();
        //pageSize 每页显示的条数
        Integer pageSize = queryPageBean.getPageSize();
        //queryString 表示查询的条件
        //根据项目的原型我们发现将来进行搜索的时候是根据项目的编码以及项目名称进行搜索
        String queryString = queryPageBean.getQueryString();
        PageResult pageResult = tcmConstitutionIdentificationService.findOrderItemByCondition(currentPage,pageSize,queryString);
        return pageResult;
    }

    @DeleteMapping("/deleteTcmConstitutionIdentificationById/{id}")
    public Result deleteTcmConstitutionIdentificationById(@PathVariable("id")Integer id){
        tcmConstitutionIdentificationService.deleteTcmConstitutionIdentificationById(id);
        return new Result(true, MessageConstant.DELETE_ORDER_SUCCESS);
    }
}
